<!DOCTYPE html>
<html lang="en">
<head>
	<#include "${managerViewPath}/include/macro.ftl"/>
  	<#include "${managerViewPath}/include/meta.ftl"/>  
</head>
<body>
<@ms.content>
		<@ms.contentBody>
		<@ms.nav title="编辑">
		<@ms.savebutton id="updateButton"/>
		</@ms.nav>
			<@ms.contentPanel>
	              <@ms.form isvalidation=true name="updateWxxm" id="updateWxxm"  >
	              	<input type="hidden" id = "zd" value = "${jyItemWxxm.isZd?default('')}">
	              	<input type="hidden" id = "only" value = "${jyItemWxxm.isOnly?default('')}">
	              	<input type="hidden" name = 'id' value = "${jyItemWxxm.id}">
	              	<@ms.text name="wxxmName"    label="项目名称:" title="维修项目名称" maxlength="100" placeholder="请输入配件品牌" value = "${jyItemWxxm.wxxmName?default('')}"  validation={"required":"true", "data-bv-notempty-message":"维修项目名称不能为空"} style="width:50%;"/>
		    		<@ms.select  name="wxxmPjlb" label="使用配件"  list=pJlist  id="wxxmPjlb" listKey="id"  listValue="pjlbName" value="${jyItemWxxm.wxxmPjlb?default('')}" validation={"required":"true", "data-bv-notempty-message":"配件类别不能为空"} style="width:33%"/>
		    		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "checkbox" id = "isZd" name = "isZd" value = "0"   class="text-center" /><label for= "isZd">允许客户自带</label>
		    		<@ms.text name="wxxmPrice"    label="维修费用:" title="维修费用" maxlength="100" placeholder="请输入维修费用" value = "${jyItemWxxm.wxxmPrice?default('')}" validation={"required":"true", "data-bv-notempty-message":"维修费用不能为空"} style="width:50%;"/>
		    		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type = "checkbox" id = "isOnly" name = "isOnly" value = "0"/><label for= "isOnly">可作为单独维修项目</label>
		    	</@ms.form>
			</@ms.contentPanel>	
		</@ms.contentBody>
		</@ms.content>
</body>	
<script>

if($("#zd").val()=="0"){
$("[name='isZd']").attr("checked",true);
}
if($("#only").val()=="0"){
$("[name='isOnly']").attr("checked",true);
}
$("#updateButton").click(function(){
// $("#updateWxxm")[0].submit();
	var vobj = $("#updateWxxm").data('bootstrapValidator').validate();
	if(vobj.isValid()){
$.ajax({
		url:"${managerPath}/wx/update.do",
		data:$("[name='updateWxxm']").serialize(),
		dataType:"json",
		type:"post",
		success:function(data){
		if(data.flag=="0"){
			alert("保存成功！");
			location.href="${managerPath}/wx/wxxmList.do";
		}else if(data.flag=="1"){
			alert(data.resMsg);
		}else{
			alert("编辑不成功！稍后再试！")
			}
		},
		error:function(){
			alert("系统异常！");
		}
	});
}
}
)
</script>
</html>